//package com.easyskool.filter;
//
//import java.io.IOException;
//import java.util.Map;
//
//import org.codehaus.jackson.JsonGenerationException;
//import org.codehaus.jackson.JsonParseException;
//import org.codehaus.jackson.map.JsonMappingException;
//import org.codehaus.jackson.map.ObjectMapper;
//
//import com.easyskool.constants.ServiceRequestFilterHelperContants;
//import com.easyskool.utilfunction.NullObjects;
//import com.sun.jersey.spi.container.ContainerRequest;
//
//@SuppressWarnings("rawtypes")
//public class ServiceRequestFilterHelper {
//
//	String userName = null;
//	String password = null;
//	String priviledge=null;
//	Map formValue = null;
//	Map whereClause = null;
//	Map updateClause = null;
//	Map whereListClause = null;
//	
//	
//	public ContainerRequest setRequestParams(ContainerRequest request,  Map reqParam, String serviceMethodName) throws JsonParseException, JsonMappingException, IOException {
//		if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_VALIDATE_CREDENTAILS)) {
//			request = setRequestParamValidateCreditials(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_USER)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_MASTER_CLASS)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_MASTER_CLASS)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_MASTER_CLASS)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_MASTER_CLASS)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_MASTER_SUBJECT)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_MASTER_SUBJECT)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_MASTER_SUBJECT)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_MASTER_SUBJECT)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_MASTER_SECTION)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_MASTER_SECTION)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_MASTER_SECTION)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_MASTER_SECTION)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_MASTER_SECTION)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_MASTER_CLASS)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_MODERATOR_DETAILS)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_MODERATOR_DETAILS)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_MODERATOR_DETAILS)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_MODERATOR_DETAILS)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_MODERATOR_DETAILS)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_APPROVE_SCHOOL_REQUEST)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_REJECT_SCHOOL_REQUEST)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_SCHOOL_REQUEST)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_SCHOOL_REQUEST)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_ADMIN)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_ADMIN)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_ADMIN)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_ADMIN)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_ADMIN)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_ACCESS_AUTHORIZE)) {
//			request = setRequestParamUpdatewithPriviledge(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_SET_PERSONAL_DETAILS)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}	
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_SEND_PASSWORD_DETAILS)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_CHANGE_PASSWORD_DETAILS)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_SECTIONS)) {
//			request = setRequestParamNoParam(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_TEACHERS)) {
//			request = setRequestParamNoParam(request, reqParam);
//		}
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_SUBJECTS)) {
//			request = setRequestParamGet(request, reqParam);
//		}
//		 
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_TEACHER)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_TEACHER)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_TEACHER)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_TEACHERS)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_TEACHER)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}
//		
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_MODERATOR)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_MODERATOR)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_MODERATOR)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_MODERATORS)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_MODERATOR)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}
//		
//		else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_INSERT_SUBJECT)) {
//			request = setRequestParamInsert(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_GET_SUBJECT)) {
//			request = setRequestParamGet(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SUBJECT)) {
//			request = setRequestParamDelete(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_DELETE_SELECTED_SUBJECTS)) {
//			request = setRequestParamDeleteSelected(request, reqParam);
//		}else if (serviceMethodName.equalsIgnoreCase(ServiceRequestFilterHelperContants.SERVICE_METHOD_UPDATE_SUBJECT)) {
//			request = setRequestParamUpdate(request, reqParam);
//		}
//		
//		
//		return request;
//	}
//
//	private ContainerRequest setRequestParamNoParam(ContainerRequest request,
//			Map reqParam) {
//		return request;
//	}
//	
//
//	private ContainerRequest setRequestParamDelete(ContainerRequest request,
//			Map reqParam) throws JsonGenerationException, JsonMappingException, IOException {
//		
//			if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM))){
//				userName = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM);
//			}
//			if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE))){
//				whereClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE);
//			}
//			ObjectMapper mapper = new ObjectMapper();
//			String whereMap = null;
//			whereMap = mapper.writeValueAsString(whereClause);
//			
//			request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM, userName);
//			request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.WHERE_CLAUSE, whereMap);
//			
//			return request;
//	}
//	
//	private ContainerRequest setRequestParamDeleteSelected(ContainerRequest request,
//			Map reqParam) throws JsonGenerationException, JsonMappingException, IOException {
//		
//			if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM))){
//				userName = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM);
//			}
//			if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE))){
//				whereListClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE);
//			}
//			ObjectMapper mapper = new ObjectMapper();
//			String whereMap = null;
//			whereMap = mapper.writeValueAsString(whereListClause);
//			
//			request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM, userName);
//			request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.WHERE_CLAUSE, whereMap);
//			
//			return request;
//	}
//
//	private ContainerRequest setRequestParamUpdate(ContainerRequest request,
//			Map reqParam) throws JsonGenerationException, JsonMappingException, IOException {
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM))){
//			userName = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM);
//		}
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE))){
//			whereClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE);
//		}
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.UPDATE_CLAUSE))){
//			updateClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.UPDATE_CLAUSE);
//		}
//		ObjectMapper mapper = new ObjectMapper();
//		String whereMap = null;
//		whereMap = mapper.writeValueAsString(whereClause);
//		String updateMap = mapper.writeValueAsString(updateClause);
//		
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM, userName);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.WHERE_CLAUSE, whereMap);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.UPDATE_CLAUSE, updateMap);
//		
//		return request;
//	}
//	
//	private ContainerRequest setRequestParamUpdatewithPriviledge(ContainerRequest request,
//			Map reqParam) throws JsonGenerationException, JsonMappingException, IOException {
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_PRIVILEDGE_PARAM))){
//			priviledge = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_PRIVILEDGE_PARAM);
//		}
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE))){
//			whereClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE);
//		}
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.UPDATE_CLAUSE))){
//			updateClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.UPDATE_CLAUSE);
//		}
//		ObjectMapper mapper = new ObjectMapper();
//		String whereMap = null;
//		whereMap = mapper.writeValueAsString(whereClause);
//		String updateMap = mapper.writeValueAsString(updateClause);
//		
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_PRIVILEDGE_PARAM, priviledge);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.WHERE_CLAUSE, whereMap);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.UPDATE_CLAUSE, updateMap);
//		
//		return request;
//	}
//	private ContainerRequest setRequestParamGet(ContainerRequest request,
//			Map reqParam) throws JsonGenerationException, JsonMappingException, IOException {
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM))){
//			userName = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM);
//		}
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE))){
//			whereClause = (Map)reqParam.get(ServiceRequestFilterHelperContants.WHERE_CLAUSE);
//		}
//		ObjectMapper mapper = new ObjectMapper();
//		String filterString = null;
//		filterString = mapper.writeValueAsString(whereClause);
//		
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM, userName);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.WHERE_CLAUSE, filterString);
//		return request;
//	}
//
//	private ContainerRequest setRequestParamInsert(
//			ContainerRequest request, Map reqParam) throws JsonParseException, JsonMappingException, IOException {
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM))){
//			userName = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM);
//		}
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_FORM_FIELD_PARAM))) {
//			formValue = (Map)reqParam.get("fields");
//		} 
//		System.out.println("form value  : "+formValue);
//		ObjectMapper mapper = new ObjectMapper();
//		String filterString = mapper.writeValueAsString(formValue);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_FORM_FIELD_PARAM, filterString);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM, userName);
//		return request;
//	}
//
//	private ContainerRequest setRequestParamValidateCreditials(
//			ContainerRequest request, Map reqParam) {
//		
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM))){
//			userName = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM);
//		}
//		
//		if(!NullObjects.isNull(reqParam.get(ServiceRequestFilterHelperContants.REQUEST_PASSWORD_PARAM))){
//			password = (String)reqParam.get(ServiceRequestFilterHelperContants.REQUEST_PASSWORD_PARAM);
//		}
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_PASSWORD_PARAM, password);
//		request.getQueryParameters().putSingle(ServiceRequestFilterHelperContants.REQUEST_USER_PARAM, userName);
//		System.out.println("request "+request.getQueryParameters());
//		return request;
//	}
//	
//}
